<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <title>简单个人页面</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <link rel="stylesheet" href="/js/bootstrap/css/bootstrap.min.css">
    <link rel="stylesheet" href="/css/font/css/font-awesome.min.css" />
    <link rel="stylesheet" href="/css/reset.css">
    <script src="/js/jquery/jquery.min.js"></script>
    <script src="../js/plugins/jrender/jrender.min.js"></script>

    <style>
        .simplePerson {
            text-align: center;
            color: #7A786F;
            padding-top: 50px;
            padding-bottom: 110px;
            background-color: #E8E6E8;
        }

        .mymenu {
            margin: 15px auto;
        }

        .mymenu i {
            margin-right: 20px;
        }

    </style>

    <script>
        $(function () {
            var userStr = sessionStorage.getItem("user");
            var userJSON;
            if (userStr){
                //把JSON字符串转成JSON对象
                userJSON = JSON.parse(userStr);
                //将用户数据渲染到页面
                $(".simplePerson").renderValues(userJSON);
            }
            //用户注销操作
            $("#logoutBtn").click(function () {
                $.ajax({
                    type:"DELETE",
                    url:"/users/session",
                    success:function (data) {
                        if (data.success){
                            location.reload();
                            //把静态页面的缓存数据也一并清除
                            sessionStorage.removeItem("user");
                            window.parent.location.href = "/login.html";
                        }
                    }
                })
            });

            //我的页面的跳转
            //在父页面中访问子页面的href
            $("#myhref").click(function () {
                var href = $(this).data("href");
                window.parent.location.href = href;
            })

        })
    </script>



</head>


<body>

<div class="simplePerson">
    <img  class="rounded-circle" width="20%" render-src="headImgUrl">
    <p><strong render-html="nickName"></strong></p>
    <p render-html="email"></p>
    <hr>

    <div class="mymenu">
        <i class="fa fa-user fa-2x fa-fw"></i>
        <a href="javascript:;" data-href="/mine/profiles.html" id="myhref" >
            我的</a>
    </div>

    <div class="mymenu">
        <i class="fa fa-bell fa-2x fa-fw"></i>
        <a href="#">信息</a>
    </div>
    <div class="mymenu">
        <i class="fa fa-comment fa-2x fa-fw"></i>
        <a href="#">通知</a>
    </div>
    <div class="mymenu">
        <i class="fa fa-cog fa-2x fa-fw"></i>
        <a href=/mine/info.html">设置</a>
    </div>
    <hr style="margin-top: 50px;">
    <div class="mymenu">
        <i class="fa fa-sign-out fa-2x fa-fw"></i>
        <label id="logoutBtn">退出登录</label>
    </div>
</div>



</body>

</html>